package com.sino.struts2;

import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;
import com.sino.business.IZlIntroService;
import com.sino.model.ZlIntroModel;

public class ZlIntroAction extends ActionSupport{
	private IZlIntroService zlIntroService = null;
	private ZlIntroModel zlIntroModel = null;
	private String zlid="";
	
	public String getZlid() {
		return zlid;
	}
	public void setZlid(String zlid) {
		this.zlid = zlid;
	}
	//-----------------------保存专利简介
	public String saveZlIntro(){
		HttpSession session = ServletActionContext.getRequest().getSession();
		String zlId = (String)session.getAttribute("zlid");
		zlIntroModel.setZlid(zlId);
		this.getZlIntroService().saveZlIntro(zlIntroModel);
		return this.SUCCESS;
	}
	//------------------------更新专利简介
	public String updateZlIntro(){
		HttpSession session = ServletActionContext.getRequest().getSession();
		String zlId = (String)session.getAttribute("zlid2");
		zlIntroModel.setZlid(zlId);
		this.getZlIntroService().saveZlIntro(zlIntroModel);
		return this.SUCCESS;
	}
	//------------------------查找专利简介
	public String findZlIntro(){
		HttpSession session = ServletActionContext.getRequest().getSession();
		String zlId = (String)session.getAttribute("zlid");
		this.setZlIntroModel(this.getZlIntroService().findZlintro(zlId));
		return this.SUCCESS;
	}	
	public String findZlIntroToPrint(){
		if("".equals(zlid))
		{
			HttpSession session = ServletActionContext.getRequest().getSession();
				zlid = (String)session.getAttribute("zlid");
		}
		this.setZlIntroModel(this.getZlIntroService().findZlintro(zlid));
		
		return this.SUCCESS;
	}
	//------------------------查找专利简介---用于更新
	public String findUpdateZlIntro(){
		HttpSession session = ServletActionContext.getRequest().getSession();
		String zlId = (String)session.getAttribute("zlid2");
		this.setZlIntroModel(this.getZlIntroService().findZlintro(zlId));
		return this.SUCCESS;
	}
	//-------------------------------------------接口
	public ZlIntroModel getZlIntroModel() {
		return zlIntroModel;
	}
	public void setZlIntroModel(ZlIntroModel zlIntroModel) {
		this.zlIntroModel = zlIntroModel;
	}
	public IZlIntroService getZlIntroService() {
		return zlIntroService;
	}
	public void setZlIntroService(IZlIntroService zlIntroService) {
		this.zlIntroService = zlIntroService;
	}
	
}
